package com.gxa.service.impl;

import com.gxa.mapper.UserMapper;
import com.gxa.pojo.Role;
import com.gxa.pojo.User;
import com.gxa.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sun.nio.cs.ext.MacArabic;

import java.util.List;
import java.util.Map;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public String findDepartmentNameById(Integer id) {
        return userMapper.findDepartmentNameById(id);
    }

    @Override
    public String findDutyNameById(Integer id) {
        return userMapper.findDutyNameById(id);
    }

    @Override
    public List<User> findUserByPage(Integer page, Integer size) {
        return userMapper.findUserByPage(page, size);
    }

    @Override
    public Integer findAllUser() {
        return userMapper.findAllUser();
    }

    @Override
    public int insertUser(Map map) {
        return userMapper.insertUser(map);
    }

    @Override
    public Integer deleteUserById(Integer id) {
        return userMapper.deleteUserById(id);
    }

    @Override
    public Integer updateUser(Map map) {
        return userMapper.updateUser(map);
    }

    @Override
    public Integer updateUserState(Map map) {
        return userMapper.updateUserState(map);
    }

    @Override
    public List<User> selectUserByNameAndUserName(Map map) {
        return userMapper.selectUserByNameAndUserName(map);
    }

    @Override
    public List<User> selectUserByUserName(Map map) {
        return userMapper.selectUserByUserName(map);
    }

    @Override
    public String findUserByUserName(String userName) {
        return userMapper.findUserByUserName(userName);
    }

    @Override
    public String findUserByIdCard(String idCard) {
        return userMapper.findUserByIdCard(idCard);
    }

    @Override
    public String findUserByPhone(String phone) {
        return userMapper.findUserByPhone(phone);
    }

    @Override
    public User findRoleByUserId(Integer id) {
        return userMapper.findRoleByUserId(id);
    }

    @Override
    public List<Role> findAllRole() {
        return userMapper.findAllRole();
    }

    @Override
    public Integer findAllUserBy(Map map) {
        return userMapper.findAllUserBy(map);
    }

    @Override
    public User login(String name, String passwd) {
        return userMapper.findByUserNameAndPwd(name, passwd);
    }
}